Upgrade Rust to build Cargo
authorAlex Crichton <alex@alexcrichton.com>
Mon, 25 Jan 2016 18:20:23 +0000 (10:20 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 25 Jan 2016 18:43:20 +0000 (10:43 -0800)
A few small tweaks to tests were necessary to accomodate rust-lang/rust#29520,
and a few changes were made to the code to account for that as well.

src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/mod.rs
src/rustversion.txt
tests/test_cargo_compile.rs
tests/test_cargo_compile_custom_build.rs
tests/test_cargo_compile_plugins.rs

index 28881e7aad4c5d29fbd6650ece3a44985b3b8f48..c85de27c4c831114ea5739deaca806b758baa186 100644 (file)
@@ -221,7 +221,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     ///
     /// If `plugin` is true, the pair corresponds to the host platform,
     /// otherwise it corresponds to the target platform.
-    fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
+    pub fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
         let (triple, pair) = if kind == Kind::Host {
             (&self.config.rustc_info().host, &self.host_staticlib)
         } else {
index 17bd3647219275928ec6061b000174ea9e042d67..f76ba09e5c9db0a738a56f2e0e1965a1897e7d57 100644 (file)
@@ -574,7 +574,11 @@ fn build_deps_args(cmd: &mut CommandPrototype, cx: &Context, unit: &Unit)
         let layout = cx.layout(unit.pkg, unit.kind);
 
         for filename in try!(cx.target_filenames(unit)) {
-            if filename.ends_with(".a") { continue }
+            if let Ok((prefix, suffix)) = cx.staticlib(unit.kind) {
+                if filename.starts_with(prefix) && filename.ends_with(suffix) {
+                    continue
+                }
+            }
             let mut v = OsString::new();
             v.push(&unit.target.crate_name());
             v.push("=");
index 5fdf51cb8f8aaba8bd6cd02859f37b33d915e195..8af83b4bb4b2668519a933787bc73e58bd136c5b 100644 (file)
@@ -1 +1 @@
-2015-11-30
+2016-01-25
index 2460a7b278f78f496e1f11923aff59fb01f410d8..6e33657759dabc5ac286cb347cd9312e30d52cbd 100644 (file)
@@ -1738,13 +1738,12 @@ test!(predictable_filenames {
 
             [lib]
             name = "foo"
-            crate-type = ["staticlib", "dylib", "rlib"]
+            crate-type = ["dylib", "rlib"]
         "#)
         .file("src/lib.rs", "");
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0));
-    assert_that(&p.root().join("target/debug/libfoo.a"), existing_file());
     assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
     let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX,
                              env::consts::DLL_SUFFIX);
index 4778135ddbf3ac7efca2d25c2c35551a67d85013..8d74e7de0ac6948813c5e382b2e815e3cc364cd8 100644 (file)
@@ -1135,7 +1135,8 @@ test!(build_script_with_dynamic_native_dependency {
         "#)
         .file("bar/src/lib.rs", r#"
             pub fn bar() {
-                #[link(name = "builder")]
+                #[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
+                #[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
                 extern { fn foo(); }
                 unsafe { foo() }
             }
index dca74a6df871dffde35c1cd717b95a92212b8163..d6f2143a89cfed002b6f215fb1065374d33b39dd 100644 (file)
@@ -152,20 +152,21 @@ test!(plugin_with_dynamic_native_dependency {
                                                        .display());
             }
         "#)
-        .file("bar/src/lib.rs", &format!(r#"
+        .file("bar/src/lib.rs", r#"
             #![feature(plugin_registrar, rustc_private)]
             extern crate rustc_plugin;
 
             use rustc_plugin::Registry;
 
-            #[link(name = "{}")]
-            extern {{ fn foo(); }}
+            #[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
+            #[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
+            extern { fn foo(); }
 
             #[plugin_registrar]
-            pub fn bar(_reg: &mut Registry) {{
-                unsafe {{ foo() }}
-            }}
-        "#, libname));
+            pub fn bar(_reg: &mut Registry) {
+                unsafe { foo() }
+            }
+        "#);
 
     assert_that(foo.cargo_process("build").env("SRC", &lib).arg("-v"),
                 execs().with_status(0));